using System;
using System.Resources;
using System.Collections;

namespace VideoSeller.Core.Localization
{
	public class CustomResourceReader : IResourceReader
    {
        private IDictionary resources;

        /// <summary>
        /// Initializes a new instance of the <see cref="CustomResourceReader"/> class.
        /// </summary>
        /// <param name="resources">The resources.</param>
        public CustomResourceReader(IDictionary resources)
        {
            this.resources = resources;
        }

        /// <summary>
        /// Returns an <see cref="T:System.Collections.IDictionaryEnumerator"></see> of the resources for this reader.
        /// </summary>
        /// <returns>
        /// A dictionary enumerator for the resources for this reader.
        /// </returns>
        IDictionaryEnumerator IResourceReader.GetEnumerator()
        {
            return resources.GetEnumerator();
        }

        /// <summary>
        /// Closes the resource reader after releasing any resources associated with it.
        /// </summary>
        void IResourceReader.Close() { }

        /// <summary>
        /// Returns an enumerator that iterates through a collection.
        /// </summary>
        /// <returns>
        /// An <see cref="T:System.Collections.IEnumerator"></see> object that can be used to iterate through the collection.
        /// </returns>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return resources.GetEnumerator();
        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        void IDisposable.Dispose() { }
    }
}
